package com.kaili.db.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.kaili.pojo.dto.order.OrderAddBean;
import com.kaili.pojo.entity.HsOptOrder;
import com.kaili.db.mapper.HsOptOrderMapper;
import com.kaili.db.service.IHsOptOrderService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.kaili.pojo.vo.OrderQueryVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xujinghai
 * @since 2018-06-13
 */
@Service
public class HsOptOrderServiceImpl extends ServiceImpl<HsOptOrderMapper, HsOptOrder> implements IHsOptOrderService {

    @Override
    public int doAddOrder(OrderAddBean addBean) {

        HsOptOrder order = new HsOptOrder();
        BeanUtils.copyProperties(addBean,order);
        order.setCreatedTime(new Date());
        return baseMapper.insert(order);

    }

    @Override
    public Page<OrderQueryVO> queryOrderPageList(Page<OrderQueryVO> pager, Map search) {
        return pager.setRecords(baseMapper.queryOrderList(pager,search));
    }


}
